using Microsoft.AspNetCore.Mvc;
using ToolMonitoring.WebApi.Demo;

namespace ToolMonitoring.WebApi.Controllers
{

	[ApiController]
	[Route("api/[controller]/[action]")]
	public class WeatherForecastController : ControllerBase
	{
		private static readonly string[] Summaries = new[]
		{
			"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
		};

		private readonly ILogger<WeatherForecastController> _logger;

		private readonly IDemoService _idemo;
		private readonly DemoService _idemo2;

		public WeatherForecastController(ILogger<WeatherForecastController> logger, IDemoService idemo, DemoService idemo2)
		{
			_logger = logger;
			_idemo = idemo;
			_idemo2 = idemo2;
		}

		[HttpGet]
		public IEnumerable<WeatherForecast> Get()
		{
			this._logger.LogInformation("GetWeatherForecast");
			var b1= _idemo.GetId()== _idemo2.GetId();

			return Enumerable.Range(1, 5).Select(index => new WeatherForecast
			{
				Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
				TemperatureC = Random.Shared.Next(-20, 55),
				Summary = Summaries[Random.Shared.Next(Summaries.Length)]
			})
			.ToArray();

		}
	}
}
